#include <iostream>

using namespace std;

const int N = 100010;

    int q[N];

int main()
{
    int n = 0;
    scanf("%d", &n);

    for (int i = 0; i < n; i++)
        scanf("%d", &q[i]);

    int k = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if (q[i] > q[j])
                k++;
        }
    }

    printf("%d", k);

    return 0;
}